);
$class = MWLBFactory::getLBFactoryClass( $lbConf );
- $instance = new $class( $lbConf );
- MWLBFactory::setSchemaAliases( $instance, $mainConfig->get( 'DBtype' ) );
-
- return $instance;
+ return new $class( $lbConf );
},
'EventRelayerGroup' => function ( MediaWikiServices $services ) : EventRelayerGroup {
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\LoggerFactory;
-use Wikimedia\Rdbms\LBFactory;
use Wikimedia\Rdbms\DatabaseDomain;
/**
return $class;
}
- /**
- * @param LBFactory $lbFactory
- * @param string $dbType 'mysql', 'sqlite', etc.
- * @internal For use with service wiring
- */
- public static function setSchemaAliases( LBFactory $lbFactory, $dbType ) {
- if ( $dbType === 'mysql' ) {
- /**
- * When SQLite indexes were introduced in r45764, it was noted that
- * SQLite requires index names to be unique within the whole database,
- * not just within a schema. As discussed in CR r45819, to avoid the
- * need for a schema change on existing installations, the indexes
- * were implicitly mapped from the new names to the old names.
- *
- * This mapping can be removed if DB patches are introduced to alter
- * the relevant tables in existing installations. Note that because
- * this index mapping applies to table creation, even new installations
- * of MySQL have the old names (except for installations created during
- * a period where this mapping was inappropriately removed, see
- * T154872).
- */
- $lbFactory->setIndexAliases( [
- 'un_user_id' => 'user_id',
- 'un_user_ip' => 'user_ip',
- ] );
- }
- }
-
/**
* Log a database deprecation warning
* @param string $msg Deprecation message
'patch-drop-archive-ar_usertext_timestamp.sql' ],
[ 'dropIndex', 'archive', 'usertext_timestamp', 'patch-drop-archive-usertext_timestamp.sql' ],
[ 'dropField', 'logging', 'log_user', 'patch-drop-user-fields.sql' ],
+ [ 'addIndex', 'user_newtalk', 'un_user_ip', 'patch-rename-mysql-user_newtalk-indexes.sql' ],
];
}
--- /dev/null
+-- T233240: The indexes on `user_newtalk` may be named `un_user_id`/`un_user_ip`
+-- or `user_id`/`user_ip`. At least it won't be both or mixed. Rename them to
+-- the former.
+
+-- Do not use the /*i*/ hack here!
+ALTER TABLE /*_*/user_newtalk
+ DROP INDEX user_id,
+ DROP INDEX user_ip,
+ ADD INDEX un_user_id (user_id),
+ ADD INDEX un_user_ip (user_ip);